{layout name="public/layout" /}
{include file='yxnavbar'}


<div class="main">
<!--    {include file='sms_header'}-->
    <div class="panel panel-info">
        <div class="panel-heading">筛选 共{$total}条
            <span style="color: red;font-weight: bold;font-size: 16px;">
                {if $config['open_yx_sms']==1}
                【 成功发送 {$used_sms} 条 ，消费 {$used_amount} 元】
                {else}
                 【 短信通知未开通 】 开通请到 "活动编辑" => "短信" 中开启，如有疑问请联系客服！
                {/if}
            </span>
        </div>
        <div class="panel-body">
            <form action="./index.php" method="get" class="form-horizontal" role="form">
                <input type="hidden" name="c" value="site" />
                <input type="hidden" name="a" value="entry" />
                <input type="hidden" name="m" value="{$_P['m']}" />
                <input type="hidden" name="do" value="{$do}" />
                <input type="hidden" name="ac" value="search" />
                <input type="hidden" name="themeid" value="{$themeid}" />

                <div class="form-group">
                    <label class="col-xs-1 col-sm-1 col-md-1 control-label">场景</label>
                    <div class="col-xs-11 col-sm-9 col-md-9">
                        <div class="btn-group">
                            {loop $template_list $row}
                            <a href="{php echo createWebUrl('sms',array('op' => 'display','themeid'=>$themeid,'type'=>$row['type']));}" class="btn {if $type == $row['type']}btn-primary{else}btn-default{/if}">
                                {$row['name']}
                                <span style="color: #ff0000">{$row['total']}</span>
                            </a>
                            {/loop}
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-1 col-sm-1 col-md-1 control-label">发送状态</label>
                    <div class="col-xs-11 col-sm-9 col-md-9">
                        <div class="btn-group">
                            {loop $status_list $row}
                            <a href="{php echo createWebUrl('sms',array('op' => 'display','themeid'=>$themeid,'status'=>$row['status']));}" class="btn {if $status == $row['status']}btn-primary{else}btn-default{/if}">
                                {$row['name']}
                                <span style="color: #ff0000">{$row['total']}</span>
                            </a>
                            {/loop}
                        </div>
                    </div>
                </div>
                {if $_G['isSuperAdmin']}
                <div class="form-group">
                    <label class="col-xs-1 col-sm-1 col-md-1 control-label">送达状态</label>
                    <div class="col-xs-11 col-sm-9 col-md-9">
                        <div class="btn-group">
                            {loop $trade_status_list $row}
                            <a href="{php echo createWebUrl('sms',array('op' => 'display','themeid'=>$themeid,'trade_status'=>$row['trade_status']));}" class="btn {if $trade_status == $row['trade_status']}btn-primary{else}btn-default{/if}">
                                {$row['name']}
                                <span style="color: #ff0000">{$row['total']}</span>
                            </a>
                            {/loop}
                        </div>
                    </div>
                </div>
                {/if}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-1 control-label">关键字</label>
                    <div class="col-sm-9 col-xs-2 col-md-3">
                        <input class="form-control" name="search_data" placeholder="输入手机号、微信昵称、用户名" type="text" value="{$_P['search_data']}">

                    </div>
                    <div class="col-sm-3 col-lg-3 col-md-3 col-xs-6">
                        <button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
                        <input type="hidden" name="__token__" value="{$Request.token}"/>
                    </div>
                    <div class="col-sm-2 col-lg-2 col-md-2 col-xs-2">
                        {if $total<=5000}
                        <input class="btn btn-default" type="submit" name="export_submit" id="export_submit" value="导出记录EXCEL">
                        {else}
                        <input class="btn btn-default" type="submit" name="export_submit" id="export_submit" value="导出记录EXCEL(1-5000条)">
                        {/if}
                    </div>
                    {if $has_limit_sms>0}
                    <div class="col-sm-3 col-lg-3 col-md-3 col-xs-6">
                        <a href="{php echo createWebUrl('sms',array('op'=>'reissue','themeid'=>$themeid));}" class="btn btn-success">短信补发</a>
                    </div>
                    {/if}
                </div>
                <span class="help-block" >短信按照每 67 个字符计费为一条短信，最长不超过350 个字符，短信长度计算：短信签名字数 + 短信模版实际发送内容字数。最终以实发短信长度为准。</span>
                {if $has_limit_sms>0}
                <span class="help-block" style="color: red;">系统存在待补发短信，如需发送请点击短信补发（活动编辑-短信-短信通知规则达到设定的上限，部分短信中断发送；请及时观察并修改合适设置）</span>
                {/if}
            </form>
        </div>
    </div>
    <div class="tab-content">
        <div class="panel panel-default">
            <div class="panel-body table-responsive">
                <table class="table table-hover">
                    <thead class="navbar-inner">
                    <tr>
                        <th style="width: 80px;">序号</th>
                        <th style="width: 80px;">头像昵称</th>
                        <th style="width: 80px;">场景</th>
                        <th style="width: 100px;">姓名电话</th>
                        <th style="width: 280px;">短信内容</th>
                        <th style="width: 80px;">发送状态</th>
                        {if $_G['isSuperAdmin']}
                        <th style="width: 80px;">送达状态</th>
                        {/if}
                        <th style="width: 140px;">发送时间</th>
                    </tr>
                    </thead>
                    <tbody>
                    {loop $list $item}
                    <tr>
                        <td>{$item['id']}</td>
                        <td>
                            <img src="{php echo tomedia($item['avatar']);}" width="28" style="bsection-radius: 3px;"><br>{$item['nickname']}
                        </td>
                        <td>
                            <span class="label label-primary">
                                <?php $tmp_type = 'sms_'.$item['type'];?>
                                {php echo str_replace('短信:','',$name_arr[$tmp_type]);}
                            </span>
                        </td>
                        <td>{$item['username']}<br>{$item['mobile']}</td>

                        <td>{if $item['content']}【{php echo mb_substr($_G['companyname'],0,2);}】{/if}{$item['content']}</td>
                        <td>
                            {if $item['status']==1}
                            <span class="label label-success">发送成功</span>
                            {elseif $item['status']==3}
                            <span class="label label-warning">发送中断-静默用户</span>
                            {elseif $item['status']==2}
                            <span class="label label-warning">发送失败</span>
                            {/if}
                        </td>
                        {if $_G['isSuperAdmin']}
                        <td>
                            {if $item['status']==1}
                            {if $item['trade_status']=='UNKNOW'}
                            <span class="label label-primary">到达未知</span>
                            {elseif $item['trade_status']=='DELIVRD'}
                            <span class="label label-success">到达成功</span>
                            {else}
                            <span class="label label-warning">运营商拦截,到达失败</span>
                            {/if}
                            {else}
                            <span class="label label-warning">未知状态</span>
                            {/if}
                        </td>
                        {/if}
                        <td>{$item['created_at']}</td>
                    </tr>
                    {/loop}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

